<footer class="bg-neutral-800 text-neutral-300">
    <div class="container mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
            <!-- 公司信息 -->
            <div class="space-y-4">
                <a href="<?php echo esc_url(home_url('/')); ?>" class="flex items-center space-x-2">
                    <div class="h-10 w-10 rounded-lg bg-primary flex items-center justify-center">
                        <i class="fa fa-newspaper-o text-white text-2xl"></i>
                    </div>
                    <span class="text-2xl font-bold text-white"><?php bloginfo('name'); ?></span>
                </a>
                <p class="text-neutral-400 text-balance"><?php bloginfo('description'); ?></p>
                <div class="flex space-x-4">
                    <a href="#" class="text-neutral-400 hover:text-white transition-colors"><i class="fa fa-wechat fa-lg"></i></a>
                    <a href="#" class="text-neutral-400 hover:text-white transition-colors"><i class="fa fa-weibo fa-lg"></i></a>
                    <a href="#" class="text-neutral-400 hover:text-white transition-colors"><i class="fa fa-github fa-lg"></i></a>
                </div>
            </div>

            <!-- 导航链接 -->
            <div>
                <h3 class="text-lg font-semibold text-white mb-4">快速导航</h3>
                <ul class="space-y-2">
                    <?php
                    $nav_items = ['关于我们', '联系我们', '服务条款', '隐私政策'];
                    foreach ($nav_items as $item_title) {
                        $pages = get_posts(array(
                            'post_type'      => 'page',
                            'title'          => $item_title,
                            'posts_per_page' => 1,
                            'post_status'    => 'publish'
                        ));
                        if ( ! empty($pages) ) {
                            $page = $pages[0];
                            echo '<li><a href="' . get_permalink($page->ID) . '" class="hover:text-white transition-colors">' . esc_html($item_title) . '</a></li>';
                        }
                    }
                    ?>
                </ul>
            </div>

            <!-- 最新文章 -->
            <div>
                <h3 class="text-lg font-semibold text-white mb-4">最新内容</h3>
                <ul class="space-y-2">
                    <?php
                    $recent_posts = new WP_Query(array(
                        'posts_per_page'      => 3,
                        'post_status'         => 'publish',
                        'ignore_sticky_posts' => 1,
                    ));
                    if ($recent_posts->have_posts()) :
                        while ($recent_posts->have_posts()) : $recent_posts->the_post();
                    ?>
                            <li><a href="<?php the_permalink(); ?>" class="hover:text-white transition-colors"><?php the_title(); ?></a></li>
                    <?php
                        endwhile;
                        wp_reset_postdata();
                    else :
                    ?>
                        <li><span class="text-neutral-400">暂无最新内容</span></li>
                    <?php endif; ?>
                </ul>
            </div>
            
            <!-- 订阅我们 -->
            <div>
                <h3 class="text-lg font-semibold text-white mb-4">订阅周刊</h3>
                <p class="text-neutral-400 mb-4">获取最新的行业动态和深度文章，直接发送到您的邮箱。</p>
                <form class="newsletter-form flex">
                    <input type="email" name="email" placeholder="输入您的邮箱" class="w-full px-3 py-2 rounded-l-md text-neutral-800 focus:outline-none focus:ring-2 focus:ring-primary" required>
                    <button type="submit" class="bg-primary px-4 py-2 rounded-r-md text-white font-semibold hover:bg-primary/90 transition-colors">订阅</button>
                </form>
                <p class="newsletter-feedback text-sm mt-2 h-4"></p>
            </div>
        </div>
        
        <div class="mt-12 border-t border-neutral-700 pt-8 flex flex-col sm:flex-row justify-between items-center text-sm text-center space-y-4 sm:space-y-0">
            <div class="text-neutral-400 space-x-4">
                <?php
                $copyright = wanzi_option('s_copyright', 'COPYRIGHT © ' . wp_date('Y') . ' ' . get_bloginfo('name') . '. ALL RIGHTS RESERVED.');
                $icp = wanzi_option('s_icp');
                $gov = wanzi_option('s_gov');
                $gov_link = wanzi_option('s_gov_link');
                ?>
                <span><?php echo esc_html($copyright); ?></span>
                <?php if ($icp) : ?>
                    <a href="https://beian.miit.gov.cn/" target="_blank" rel="nofollow" class="hover:text-white"><?php echo esc_html($icp); ?></a>
                <?php endif; ?>
                 <?php if ($gov && $gov_link) : ?>
                    <a href="<?php echo esc_url($gov_link); ?>" target="_blank" rel="nofollow" class="hover:text-white"><?php echo esc_html($gov); ?></a>
                <?php endif; ?>
            </div>
            <p class="text-neutral-500">由 <a href="https://wordpress.org" target="_blank" rel="noopener noreferrer" class="hover:text-white">WordPress</a> 强力驱动</p>
        </div>
    </div>
</footer>

<?php wp_footer(); ?>
</body>
</html> 